package com.v2future.sjt.collegecheckingattendance.leave;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import com.v2future.sjt.collegecheckingattendance.BaseFragment;
import com.v2future.sjt.collegecheckingattendance.LazyFragment;
import com.v2future.sjt.collegecheckingattendance.LoginActivity;
import com.v2future.sjt.collegecheckingattendance.R;
import com.v2future.sjt.collegecheckingattendance.common.activity.DatePickerActivity;
import com.v2future.sjt.collegecheckingattendance.leave.UpLoadPhotoActivity;
import com.v2future.sjt.collegecheckingattendance.rollcall.SelectSubjectActivity;
import com.v2future.sjt.collegecheckingattendance.utils.DateUtil;
import com.v2future.sjt.collegecheckingattendance.utils.IntentKey;

/**
 * Created by Administrator on 2016/1/18.
 * 请假主页面
 */
public class LeaveFragment extends LazyFragment {

    LinearLayout hoursLeaveLayout, outLeaveLayout, cancelOutLeaveLayout;
    LinearLayout courseLeaveRecordLayout;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_leave, container, false);
        initView(view);
        return view;
    }

    private void initView(View view) {
        hoursLeaveLayout = (LinearLayout) view.findViewById(R.id.layout_apply_hour_leave);
        hoursLeaveLayout.setOnClickListener(mClickListener);
        outLeaveLayout = (LinearLayout) view.findViewById(R.id.layout_apply_out_leave);
        outLeaveLayout.setOnClickListener(mClickListener);
        cancelOutLeaveLayout = (LinearLayout) view.findViewById(R.id.layout_cancel_out_leave);
        cancelOutLeaveLayout.setOnClickListener(mClickListener);
        courseLeaveRecordLayout = (LinearLayout) view.findViewById(R.id.layout_course_leave_record);
        courseLeaveRecordLayout.setOnClickListener(mClickListener);
    }

    public View.OnClickListener mClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            switch (v.getId()) {
                //请课时假
                case R.id.layout_apply_hour_leave:
                    Intent intent = new Intent(getBaseActivity(), CourseLeaveTeacherActivity.class);
                    startActivity(intent);
                    break;
                //请外出假
                case R.id.layout_apply_out_leave:
                    Intent dateIntent = new Intent(getBaseActivity(), OutLeaveDatePickerActivity.class);
                    startActivity(dateIntent);
                    break;
                //销外出假
                case R.id.layout_cancel_out_leave:
                    Intent cancelLeaveInent = new Intent(getBaseActivity(), CancelLeaveActivity.class);
                    startActivity(cancelLeaveInent);
                    break;
                //课时假记录
                case R.id.layout_course_leave_record:
                    Intent courseLeaveRecordInent = new Intent(getBaseActivity(), CourseLeaveRecordActivity.class);
                    startActivity(courseLeaveRecordInent);
                    break;
                default:
                    break;
            }
        }
    };

    @Override
    protected void lazyLoad() {

    }
}
